﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="userlist.aspx.cs" Inherits="weikebuluo.web.admin.user.userlist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta content="微客部落" name="Keywords" />
    <meta content="微客部落二维码" name="Description" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/bootstrap.responsive.min.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/style.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/todc_bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/themes.css" />
    <link rel="stylesheet" type="text/css" href="/css/Bootstrap/inside.css" />
    <script type="text/javascript" src="/Scripts/JQuery.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.cookie.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.min.js"></script>
    <script type="text/javascript" src="/Scripts/JQuery.form.wizard.min.js"></script>
    <script type="text/javascript" src="/Scripts/Bootstrap.min.js"></script>
    <script type="text/javascript" src="/Scripts/Inside.js"></script>
    <title>超级管理员</title>
</head>
<body>
    <div id="main">
        <div class="container-fluid">
            <div class="row-fluid">
                <div class="span12">
                    <div class="box">
                        <div class="box-title">
                            <div class="span8">
                                <h3>
                                    <i class="icon-table"></i>客户列表</h3>
                            </div>
                            <div class="span4">
                                <div class="form-horizontal">
                                    <input id="keyword-input" name="keyword-input" value="" class="input-small-z" style="width: 200px;"
                                        placeholder="请输入用户名或密码" data-rule-required="true" type="text" />
                                    <%-- <select style="width: 110px;" class="input-small" name="type">
                                        <option value="user_name" selected="selected">用户名</option>
                                        <option value="user_phone">电话号码</option>
                                        <option value="user_email">邮箱</option>
                                        
                                    </select>--%>
                                    <button id="btn_Search" class="btn">
                                        查询</button>
                                </div>
                            </div>
                        </div>
                        <div class="box-content nozypadding">
                            <div class="row-fluid">
                                <div class="span8 control-group">
                                <a class="btn" href="user.aspx"><i ></i>新增</a>
                                    <a class="btn" href="javascript:location.reload()"><i class="icon-refresh"></i>刷新</a>
                                </div>
                            </div>
                            <div class="row-fluid dataTables_wrapper">
                                <table id="listTable" class="table table-hover table-nomargin table-bordered usertable dataTable">
                                </table>
                                <div class="dataTables_paginate paging_full_numbers">
                                    <span id="lb_page"></span>
                                </div>
                                <div class="dataTables_paginate paging_full_numbers">
                                    <span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
    var url = "userlist.aspx";
    var page = 1;
    $(function () {
        GetList();
        $("#btn_Search").click(function () {
            page = 1;
            GetList();
        });
    })
    function GetList() {
        $.ajax({
            url: url + "?action=list",
            type: "post",
            data: { page: page, keyword: $("#keyword-input").val() },
            success: function (msg) {
                var str = '<thead><tr><th>序号</th><th>姓名</th><th>用户名</th><th>电话号码</th><th>邮箱</th><th>注册时间</th><th>QQ</th>';
                str += '<th>操作</th></tr></thead>';
                if (msg.replace("[]", "").length > 0) {
                    msg = eval("(" + msg + ")");
                    var total = msg.total;
                    var rows = msg.rows;
                    $(rows).each(function (i) {
                        var user_no = 10 * (parseInt(page) - 1) + i + 1;

                        str += '<tr><td>' + user_no + '</td><td>' + rows[i].user_realname + '</td><td>' + rows[i].user_name + '</td><td>' + rows[i].user_phone
                         + '</td><td>' + rows[i].user_email + '</td><td>' + rows[i].user_addtime + '</td><td>' + rows[i].user_qq + '</td><td>';
                        str += '<a href="user.aspx?user_id=' + rows[i].user_id + '" class="btn" rel="tooltip" title="编辑">编辑</a>';
                        str += '<a href="javascript:Delete(' + rows[i].user_id + ')" class="btn" rel="tooltip" attr="delannounce_29393_" title="删除">删除</td></tr>';
                    });
                    if (parseInt(total) > (10 * parseInt(page))) {
                        $("#lb_page").html('<a href="#" onClick="GetPage(' + (parseInt(page) + 1) + ')">下一页</a>');
                    } else {
                        $("#lb_page").html('');
                    }
                    if (parseInt(page) > 1) {
                        $("#lb_page").html('<a href="#" onClick="GetPage(' + (parseInt(page) - 1) + ')">上一页</a>' + $("#lb_page").html());
                    }
                }
                $("#listTable").html(str + "</tbady>");
            }
        });
    }
    function GetPage(p) {
        page = p;
        GetList();
    }

    function Delete(vip_id) {

        G.ui.tips.confirm("确定要删除吗？该用户的所有信息将全部删除", "userlist.aspx?action=del&user_id=" + vip_id);
    }
</script>
